﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Commerce/Views/Shared/Backend.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%: "Taxes".Localize() %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3 class="title">
        <%:"Taxes".Localize() %></h3>
    <div class="command clearfix">
        <a class="button tax-add" href="#tax-dialog">
            <%:"Create new Tax".Localize()%></a>
    </div>
    <div class="table-container">
        <table>
            <thead>
                <tr>
                    <th>
                        <%:"Name".Localize() %>
                    </th>
                    <th class="numeral">
                        <%:"Percent".Localize() %>
                    </th>
                    <th class="action">
                        <%:"Sub Tax".Localize() %>
                    </th>
                    <th class="action">
                        <%:"Edit".Localize() %>
                    </th>
                    <th class="action">
                        <%:"Delete".Localize() %>
                    </th>
                </tr>
            </thead>
            <tbody id="tax-container">
            </tbody>
        </table>
    </div>
    <table id="tax-row" class="hide">
        <tbody>
            <tr class="template">
                <td>
                </td>
                <td class="numeral">
                </td>
                <td class="action">
                </td>
                <td class="action">
                    <a class="o-icon edit dialog-link" href="#">
                        <%:"Edit".Localize() %></a>
                </td>
                <td class="action">
                    <form action='<%= ViewData["delete_action"] %>' method="post">
                    <a class="o-icon delete delete-link" message='<%= "Are you sure you want to delete this tax?".Localize() %>'
                        href="#">
                        <%:"Delete".Localize() %></a>
                    <input type="hidden" name="Id" />
                    </form>
                </td>
            </tr>
        </tbody>
    </table>
    <!-- Dialogs -->
    <div class="hide">
        <div class="dialog" id="tax-dialog" title="Tax">
            <div id="message-box-error" class="hide message-box error message-box-error">
                <p>
                </p>
            </div>
            <div id="message-box-info" class="hide message-box info message-box-info">
                <p>
                </p>
            </div>
            <div class="common-form">
                <form action="" method="post" id="tax-form">
                <fieldset>
                    <legend></legend>
                    <table>
                        <tbody>
                            <tr>
                                <th>
                                    <label for="name">
                                        <%:"Name".Localize() %></label>
                                </th>
                                <td>
                                    <input type="text" name="Name" class="medium" />
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <label for="percent">
                                        <%:"Percent".Localize()%></label>
                                </th>
                                <td>
                                    <input type="text" name="Percent" class="mini" />%
                                    <input type="hidden" name="Id" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </fieldset>
                <div class="table-container">
                    <table>
                        <caption>
                            <%:"Sub tax".Localize() %></caption>
                        <thead>
                            <tr>
                                <th>
                                    <%:"Country".Localize() %>
                                </th>
                                <th>
                                    <%:"State/Province".Localize() %>
                                </th>
                                <th>
                                    <%:"Percent".Localize()%>
                                </th>
                                <th class="action">
                                    <%:"Remove".Localize() %>
                                </th>
                            </tr>
                        </thead>
                        <tbody id="sub-tax-container">
                        </tbody>
                    </table>
                    <a class="o-icon add subtax-add" href="#">
                        <%:"Add".Localize() %></a>
                </div>
                <div class="buttons">
                    <button type="submit">
                        <%:"Save".Localize() %></button>
                </div>
                </form>
            </div>
        </div>
        <table id="sub-tax-row">
            <tbody>
                <tr class="template">
                    <td>
                        <%: Html.DropDownList("Country.Code", ViewData["Countries"] as SelectableList, new {@class="medium country" })%>
                    </td>
                    <td>
                        <input type="text" name="State" class="medium state" value="" />
                    </td>
                    <td>
                        <input type="text" name="Percent" class="mini percent" value="0" />%
                    </td>
                    <td class="action">
                        <a class="o-icon remove remove-link" message='<%= "Are you sure you want to remove this sub tax?".Localize() %>'
                            href="#" title="Remove">
                            <%:"Remove".Localize() %></a>
                        <input type="hidden" name="Id" class="id" />
                        <input type="hidden" name="SubTaxes.index" class="index" />
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
    var taxes = <%= ViewData["Taxes"] %>;
    var edit_action = '<%= ViewData["edit_action"] %>';
    var add_action = '<%= ViewData["add_action"] %>'
    </script>
    <%using (var loader = ClientLoader.RegisterInstance())
      {
          loader.Require("tax.index.js");
      } %>
</asp:Content>
